CSS Grid Layout
Build two-dimensional layouts with CSS Grid — define rows, columns, and place items with interactive controls.
Category: Web Development
·
v1.0.0
Step 1 of 4
Step 1: What is CSS Grid?
CSS Grid is a two-dimensional layout system — it handles both rows and columns simultaneously.
.container {
display: grid;
grid-template-columns: 1fr 1fr 1fr; /* 3 equal columns */
grid-template-rows: auto auto; /* 2 rows */
gap: 16px; /* spacing */
}
Key terminology:
fr— fractional unit (shares available space)gap— spacing between grid cellsgrid-template-columns— defines column tracksgrid-template-rows— defines row tracks
About This Lab
CSS Grid is the most powerful layout system in CSS, designed for two-dimensional layouts. In this lab, you'll learn to define grid containers, create rows and columns with grid-template, place items into cells, and control gaps and alignment — all with interactive controls and instant visual feedback.
How It Works
- Read each step's explanation of CSS Grid concepts
- Use the interactive controls to adjust grid properties
- Watch the live preview update in real time
- Complete the quiz to solidify your understanding